﻿using System;
using System.Windows.Automation;
using System.Windows.Forms;
// using System.Runtime.InteropServices;
// why not framework?
// so this is a complete abandon.
namespace DotNetCoreSample
{
    class Program
    {
        // static void Main(string[] args) { };
        // [DllImport("System.Windows.Forms.dll")]
        public AutomationElement sample = AutomationElement.RootElement;
        public TreeNode sampler = new TreeNode("sampler");
        private void WalkControlElements(AutomationElement rootElement, TreeNode treeNode)
{
    // Conditions for the basic views of the subtree (content, control, and raw) 
    // are available as fields of TreeWalker, and one of these is used in the 
    // following code.
    AutomationElement elementNode = TreeWalker.ControlViewWalker.GetFirstChild(rootElement);

    while (elementNode != null)
    {Console.WriteLine(elementNode.ToString());
                TreeNode childTreeNode = treeNode.Nodes.Add(elementNode.Current.ControlType.LocalizedControlType);
        WalkControlElements(elementNode, childTreeNode);
                Console.WriteLine(childTreeNode.ToString());
                elementNode = TreeWalker.ControlViewWalker.GetNextSibling(elementNode);
    }// it does not have anything in return.
}
        public static readonly System.Windows.Automation.TreeWalker RawViewWalker;
        static void Main(string[] args)
        {
            // [DllImport("UIAutomationClient.dll")]
            Program program = new Program();
            Console.WriteLine("This is the main lazero program!");
            program.WalkControlElements(program.sample, program.sampler);
            int a=program.sampler.GetNodeCount(true);
            Console.WriteLine("Node Counts: " + a.ToString());
            // falied to build shit.
        }
    }
}
// where the fuck is the dotnet?
// always have the fucking language server.
// but it does not have exe?
// how to get it executed?